/* 
 * File:   MEvent.c
 * Author: Muqtafi Akhmad
 */

#include <stdio.h>
#include <stdlib.h>
#include "Event.h"

int main(int argc, char** argv) {
    // Kamus
    long eventNo = 100;
    DateTime dateTime = MakeDateTime(2012, 10, 20, 20, 0, 0);
    Point position = MakePoint(11.00, 12.00);
    char description[EVENT_DESCRIPTION_MAX_LENGTH] = "Acara Syukuran Wisuda Oktober 2012";
    char** participants;
    participants = (char**) malloc(2 * sizeof (char*));
    participants[0] = (char*) malloc(PARTICIPANT_NAME_MAX_LENGTH * sizeof (char));
    participants[1] = (char*) malloc(PARTICIPANT_NAME_MAX_LENGTH * sizeof (char));
    short int participantCount = 2;

    // Algoritma
    strcpy(participants[0], "Participant A");
    strcpy(participants[1], "Participant B");
    
    printf("# Event pertama \n");
    Event event1 = MakeEvent(eventNo, dateTime, position, description, participants, participantCount);
    PrintEvent(event1);
    char* _eventString = EventToString(event1);
    printf("# Event kedua \n");
    dateTime.D.year = 2013;
    eventNo = 101;
    Event event2 = MakeEvent(eventNo, dateTime, position, description, participants, participantCount);
    PrintEvent(event2);
    printf("# Compare event pertama dan kedua \n");
    if(EventLessThan(event1, event2)){
        printf("event pertama lebih kecil daripada event kedua \n");
    }else{
        printf("event kedua lebih kecil atau sama dengan event pertama \n");
    }
    
    DestroyEvent(&event1);
    DestroyEvent(&event2);
    
    return (EXIT_SUCCESS);
}

